<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<f:view contentType="text/html" xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ds="http://deltaspike.apache.org/jsf"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:zanata="http://java.sun.com/jsf/composite/zanata">
  <!--[if lt IE 7]>      <html class="no-js new-zanata lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
  <!--[if IE 7]>         <html class="no-js new-zanata lt-ie9 lt-ie8"> <![endif]-->
  <!--[if IE 8]>         <html class="no-js new-zanata lt-ie9"> <![endif]-->
  <!--[if gt IE 8]><!-->
  <html class="no-js new-zanata template">
  <!--<![endif]-->
  <!-- Provided by Copyright (c) 2015 Silktide Ltd under the MIT license -->
  <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
  <script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
  <script>
    window.addEventListener("load", function(){
    window.cookieconsent.initialise({
      "palette": {
        "popup": {
          "background": "#eaf7f7",
          "text": "#546677"
        },
        "button": {
          "background": "transparent",
          "text": "#03A6D7",
          "border": "#546677"
        }
      },
      "content": {
        "message": "The Zanata web application uses cookies to operate. For more information, please refer to",
        "link": "our privacy policy",
        "href": "http://zanata.org/privacy"
      }
    })});
  </script>
  <h:head>
    <ui:remove>
      <!-- This needs to appear before all other JavaScript, for accurate testing -->
    </ui:remove>
    <h:outputText value="#{javaScriptTestHelper.headScript}" escape="false" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>

    <title>#{msgs['jsf.Zanata']}: <ui:insert name="page_title"/></title>

    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <meta name="viewport" content="width=device-width, minimum-scale=1.0"/>
    <meta http-equiv="cleartype" content="on"/>

    <!-- Preconnect SourceSansPro (Google Fonts) via FontFace in legacyJS
    -->
    <link rel="preconnect" href="https://fonts.gstatic.com/"
      crossorigin="anonymous" />

    <!-- Preloader for zanata (icon) webfont.
         zanata-war/src/main/webapp/resources/assets/css/style.css
         Lines 3339-3342
    -->
    <link rel="preload" as="font" crossorigin="anonymous" type="font/woff"
      href="#{request.contextPath}/resources/assets/fonts/zanata-v6/zanata.woff" />

    <link rel="stylesheet" href="#{frontendAssets.frontendCss}" type="text/css"/>
    <link type="image/x-icon" rel="shortcut icon"
        href="#{request.contextPath}/resources/assets/img/logo/logo.ico" />
    <link type="image/x-icon" rel="icon"
        href="#{request.contextPath}/resources/assets/img/logo/logo.ico" />

    <!--[if gt IE 8]><!-->
    <link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/assets/css/style.css"/>
    <!--<![endif]-->

    <!--[if (lt IE 9) & (!IEMobile)]>
    <script src="js/vendor/selectivizr-min.js"></script>
    <![endif]-->

    <ui:insert name="head"/>

    <script type="application/javascript">
      var globalMessageTimer;

      // automatically clear global message after 5 seconds
      function startGlobalMessageTimer() {
        if (typeof zanata == 'undefined') {
          jQuery('#messages .message--global').addClass('is-active');
        } else {
          zanata.messages.activate('#messages .message--global');
        }

        //stop previous timeout counter
        clearTimeout(globalMessageTimer);

        globalMessageTimer = setTimeout(function() {
          if (typeof zanata == 'undefined') {
            jQuery('#messages .message--global').removeClass('is-active');
          } else {
            zanata.messages.deactivate('#messages .message--global');
          }
        }, 5000);
      }
    </script>
  </h:head>

  <h:body class="templateStyle">
    <ds:windowId/>

    <a4j:outputPanel layout="block" ajaxRendered="true" id="messages">
      <ui:fragment rendered="#{showGlobalMessages != 'false'}">
        <ul class="list--no-bullets message--global">
          <zanata:global-messages value="#{jsfMessages.globalMessagesList}"
            rendered="#{not facesContext.validationFailed and not empty jsfMessages.globalMessagesList}"/>
        </ul>
        <h:outputScript
          rendered="#{not facesContext.validationFailed and not empty jsfMessages.globalMessagesList}">
          startGlobalMessageTimer();
        </h:outputScript>
      </ui:fragment>
    </a4j:outputPanel>

    <div id="config"
      data-app-url="#{request.contextPath}"
      data-server-url="#{request.contextPath}"
      data-api-server-url="#{request.contextPath}/rest"
      data-user="#{authenticatedAccountHome.getUser()}"
      data-permission="#{authenticatedAccountHome.getUserPermission().getJSON()}"
      data-links='{"loginUrl": "#{applicationConfigurationAction.getLoginUrl(request)}",
                   "registerUrl": "#{applicationConfigurationAction.registerUrl}"}'
      data-allow-register="#{allowPublicRegistration}"
      data-app-locale="#{localeSelectorAction.getLocale()}"
    >
    </div>
    <script type="application/javascript">
      window.config = JSON.parse(JSON.stringify(document.getElementById('config').dataset))
    </script>
    <div class="templateWrapper">
      <div class="templateContainer">
        <div id="root" />
        <main role="main" class="rootMain">
          <div class="l__wrapper rootMain-content l--pad-top-half">
            <ui:insert name="center_content"/>
          </div>
        </main>
        <div id="jsfReactRoot" />
      </div>
    </div>

    <script type="text/javascript"
      src="#{frontendAssets.runtime}"></script>
    <script type="text/javascript"
      src="#{frontendAssets.legacyJs}"></script>

    <ui:include src="scripts.xhtml"/>
  </h:body>
  </html>
</f:view>
